﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using CustomsSystem.BLL;
using CustomsSystem.Model;
using Maticsoft.Common;

namespace WEB.Code
{
    public partial class AddJob : System.Web.UI.Page
    {
        JobManage JM = new JobManage();
        Info_job IJ = new Info_job();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if (TextBox1.Text != "" && TextBox2.Text != "")
            {
                if (JM.Exists(TextBox1.Text) == false)
                {
                    IJ.jobNo = TextBox1.Text;
                    IJ.jobName = TextBox2.Text;
                    JM.Add(IJ);
                    Response.Write("<Script>alert('增加岗位成功!')</Script>");
                    TextBox1.Text = string.Empty;
                    TextBox2.Text = string.Empty;
                    return;
                }
                else
                {

                    Response.Write("<Script>alert('已有此编号，请重新输入!')</script>");
                    return;
                }
            }
            else
            {
                Response.Write("<Script>alert('请输入完整!')</script>");
                return;
            }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            Response.Redirect("Index_Job.aspx");
        }
    }
}